/*************************************************************************
	> File Name: Singleton.cc
	> Author: Joker
	> Mail: mahongtao@foxmail.com 
	> Created Time: 2020-09-08 11:42:00
 ************************************************************************/

#include "Singleton.h"
#include <iostream>
using std::cout;
using std::endl;

//类的静态成员变量，要在类体外进行定义
Singleton * Singleton::_pStatic = nullptr;

Singleton::Singleton(){
    cout << "Singleton()" << endl;
}
Singleton::~Singleton(){
    cout << "~Singleton()" << endl;
}

Singleton * Singleton::GetInstancePtr(){
    if(nullptr == _pStatic){
        _pStatic = new Singleton();
    }

    return _pStatic;
}

Singleton Singleton::GetInstance(){
    return *GetInstancePtr();
}

void Singleton::Test(){
    cout << "Test!" << endl;
}
